package org.example.work.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.work.pojo.Comment;

import java.util.List;

@Mapper
public interface CommentMapper {

    @Insert("INSERT INTO comment (taskid,username,createTime,replyUsername,content,level,parentCommentId) VALUES (#{taskid},#{username},#{createTime},#{replyUsername},#{content},#{level},#{parentCommentId})")
    void addComment(Comment comment);

    @Select("select `username`,`content`,createTime from comment where taskid = #{taskid} order by createTime")
    List<Comment> findCommentsByTaskId(Long taskid);


}